package com.punai.customer.mapper;

import com.punai.common.core.mapper.CommonMapper;
import com.punai.customer.domain.CusMechanicalChapter;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 机械章节Mapper接口
 *
 * @author zxw
 * @date 2022-12-04
 */
public interface CusMechanicalChapterMapper extends CommonMapper<CusMechanicalChapter>
{
    /**
     * 查询机械章节
     *
     * @param id 机械章节主键
     * @return 机械章节
     */
    public CusMechanicalChapter selectCusMechanicalChapterById(@Param("id")String id, @Param("companyId") Long companyId);

    /**
     * 查询机械章节列表
     *
     * @param cusMechanicalChapter 机械章节
     * @return 机械章节集合
     */
    public List<CusMechanicalChapter> selectCusMechanicalChapterList(CusMechanicalChapter cusMechanicalChapter);


    /**
     * 删除机械章节
     *
     * @param id 机械章节主键
     * @return 结果
     */
    public int deleteCusMechanicalChapterById(@Param("id")String id, @Param("companyId") Long companyId);

    /**
     * 批量删除机械章节
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteCusMechanicalChapterByIds(@Param("ids")List<String> ids,@Param("companyId") Long companyId);

    Integer selectMaxOrderNum(@Param("pid") String pid, @Param("companyId") Long companyId);

    void orderNumProcess(@Param("companyId") Long companyId, @Param("pid") String pid,  @Param("orderNum") Integer orderNum, @Param("num")  Integer num);

    void orderNumProcessStartEnd(@Param("companyId")Long companyId, @Param("pid")String pid, @Param("startNum") Integer startNum,
                                 @Param("endNum")Integer endNum, @Param("num")Integer num);

    List<CusMechanicalChapter> selectChildrenById(@Param("id") String id, @Param("companyId")Long companyId);

    void updateChildrenPids(@Param("childrenList") List<CusMechanicalChapter> children,@Param("companyId")Long companyId);

    List<String> selectChildrenIdById(@Param("id") String id, @Param("companyId")Long companyId);
}
